<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>GT pro钱包</title>
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
		<!--<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">-->
		<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
		<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css">
		<link rel="stylesheet" href="bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
		<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
		<link rel="stylesheet" href="dist/css/skins/skin-blue.min.css">
		<link rel="stylesheet" href="css/style.css">
		<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
		<link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
		<link type="text/css" rel="stylesheet" href="css/jeDate-test.css">
		<link type="text/css" rel="stylesheet" href="css/jedate.css">
		<link rel="stylesheet" href="bower_components/select2/dist/css/select2.min.css">
		<script type="text/javascript" src="js/jedate.js"></script>
		<script type="text/javascript" src="./libs/spark-md5-3.0.0.min.js"></script>
	    <script type="text/javascript" src="./libs/crypto-js.js"></script>
	    <script type="text/javascript" src="./libs/base64.min.js"></script>
	    <script type="text/javascript" src="./libs/ufile-token.js"></script>
		
		<style>
			.fr_title {
				display: table-cell;
				width: 100%;
				vertical-align: middle;
				height: 34px;
			}
			
			.fr_swich .fr_swich_txt {
				width: 50px;
			}
			
			.inline-block {
				display: inline-block;
			}
			
			input.picInput {
				display: none;
			}
			
			img.picShow {
				width: 80px;
			}
			
			.leftState{
				padding:0;
				min-width:120px;
				max-width:150px;
			}
			li.select2-selection__choice {
			    background-color: #5897fb !important;
				color: #fff;
			}
			li.select2-selection__choice  .select2-selection__choice__remove{
				color: #fff !important;
			}
			.select2-container--default .select2-results__option[aria-selected=true] {
			    background-color: #5897fb !important;
				color: #fff !important;
			}
		</style>
	</head>

	<body class="hold-transition skin-blue sidebar-mini">
		<div class="wrapper">
			<div class="content-wrapper">
				<section class="content-header ">
					<ol class="breadcrumb">
						<li>
							<a href="#"><i class="fa fa-dashboard"></i>系统设置</a>
						</li>
						<li class="active">云算力设置</li>
					</ol>
				</section>
				<section class="content">
					<div class="box box-primary">
						<div class="box-body">
							<div class="row">
								<div class="col-xs-12">
									<form id="setting">
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> GF总数 </div>
											</div>
											<div class="col-xs-8">
												<div class="">
													<input type="text" class="form-control" id="gf_total" name="gf_total"/>
													<!--<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">币种</button>
													</div>-->
												</div>
											</div>
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> GF 递减比例 </div>
											</div>
											<div class="col-xs-8">
												<div class="input-group">
													<input type="text" class="form-control" id="gf_decrease_rate" name="gf_decrease_rate"/>
													<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">%</button>
													</div>
												</div>
											</div>
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
													<div class="fr_title"> GF 递减周期 </div>
											</div>
											<div class="col-xs-8">
												<div class="input-group">
													<input type="text" class="form-control" id="gf_decrease_time" name="gf_decrease_time"/>
													<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">天</button>
													</div>
												</div>
											</div>
										</div>
									</div>
									
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 日发行量</div>
											</div>
											<div class="col-xs-8">
												<div class="input-group">
													<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">基础算力占比</button>
													</div>
													<input type="text" class="form-control" id="gf_basic_rate" name="gf_basic_rate"/>
													<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">%</button>
													</div>
												</div>
												<div class="input-group" style="margin-top: 10px;">
													<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">网络算力占比</button>
													</div>
													<input type="text" class="form-control" id="gf_newword_rate" name="gf_newword_rate"/>
													<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">%</button>
													</div>
												</div>
											</div>
											<!-- <div class="col-xs-1"><div title="基础"><i class="fa fa-fw fa-question-circle"></i></div></div> -->
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 算力价格 </div>
											</div>
											<div class="col-xs-8">
												<div class="input-group">
													<input type="text" class="form-control" id="power_price" name="power_price"/>
													<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">U</button>
													</div>
												</div>
											</div>
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 上榜最低业绩 </div>
											</div>
											<div class="col-xs-8">
												<!-- <div class="input-group"> -->
												<input type="text" class="form-control" id="sort_min" name="sort_min"/>
													<!-- <div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">U</button>
													</div> -->
												<!-- </div> -->
											</div>
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 矿池h5页面 </div>
											</div>
											<div class="col-xs-8">
												<!-- <div class="input-group"> -->
													<input type="text" class="form-control" id="fil_info_url" name="fil_info_url"/>
													<!-- <div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">U</button>
													</div> -->
												<!-- </div> -->
											</div>
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 产出币ID </div>
											</div>
											<div class="col-xs-8">
												<div class="">
													<select type="text" class="form-control coin_id" id="output_coin_id" name="output_coin_id"></select>
												</div>
											</div>
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 排行榜分配币ID </div>
											</div>
											<div class="col-xs-8">
												<select type="text" class="form-control coin_id" id="allot_coin_id" name="allot_coin_id"/>
												</select>
											</div>
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 可购买算力的币ID </div>
											</div>
											<div class="col-xs-8">
												<div class="">
													<select type="text" multiple="multiple" data-placeholder="Select a State" class="form-control coin_id" id="buy_coin_id" name="buy_coin_id"></select>
												</div>
											</div>
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 级别奖励</div>
											</div>
											<div class="col-xs-8">
												<div class="input-group">
													<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">同级别发放次数</button>
													</div>
													<input type="text" class="form-control" id="output_grade_number" name="output_grade_number"/>
													<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">次</button>
													</div>
												</div>
												<div class="input-group"  style="margin-top: 10px;">
													<div class="input-group-btn">
														<button type="button" class="btn btn-default" aria-expanded="false">发放币ID</button>
													</div>
													<select type="text" class="form-control coin_id" id="output_grade_coin_id" name="output_grade_coin_id"></select>
												</div>
											</div>
											<!-- <div class="col-xs-1"><div title="基础"><i class="fa fa-fw fa-question-circle"></i></div></div> -->
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 募资开始时间 </div>
											</div>
											<div class="col-xs-8">
												<div class="">
													<input type="text" class="form-control" id="mine_start_time" name="mine_start_time"/>
												</div>
											</div>
										</div>
									</div>
									<div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 是否开启兑换 </div>
											</div>
											<div class="col-xs-8">
												<div class="" >
													<input class="open" type="checkbox" style="margin-top: 9px;" id="exchange_status" name="exchange_status" >
												</div>
											</div>
										</div>
									</div>

									<!-- <div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 管理员号码</br> （多个可，隔开）</div>
											</div>
											<div class="col-xs-8">
												<div class="">
													<textarea type="text" class="form-control" rows="2" id="msg_phone" /></textarea>
												</div>
											</div>
										</div>
									</div> -->
									
									

									<!-- <div class="col-xs-12 margin">
										<div class="col-xs-12 col-sm-10 col-md-8">
											<div class="col-xs-3 leftState">
												<div class="fr_title"> 操作密码 </div>
											</div>
											<div class="col-xs-8">
												<div class="input-group">
													<span class="input-group-addon"><i class="fa fa-lock"></i></span>
													<input type="num" class="form-control" id="op_password">
													<input type="hidden" id="op_password_init" />
												</div>
											</div>
										</div>
									</div> -->
								
									
								</form>
								</div>
								<div class="col-xs-12 margin">
									<button class="btn btn-flat margin btn-success" onclick="opPwModal()" style="margin-left:30px;">保存</button>
								</div>
							</div>
						</div>
					</div>
				</section>
			</div>
		</div>
		<div class="modal fade parents in" id="opPwModal">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">	                  				
							<span aria-hidden="true">×</span>								
						</button>
						<h4 class="modal-title">操作密码</h4>
					</div>
					<div class="modal-body">
						<form class="form-horizontal">
							<div class="box-body"> <input type="hidden" name="id" value="">
								<label class="margin-bottom-none col-xs-12" style="padding-left: 0;">
										<input type="password" class="form-control"  name="opPw">
									</label>
							</div>
						</form>
					</div>
					<div class="modal-footer"> <button type="button" class="btn btn-primary save" onclick="set()">确定</button> </div>
				</div>
			</div>
		</div>
	</body>
	
	<script src="bower_components/jquery/dist/jquery.min.js"></script>
	<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
	<script src="bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
	<script src="bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
	<script src="bower_components/select2/dist/js/select2.full.min.js"></script>
	<script src="bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>

	<script src="dist/js/adminlte.min.js"></script>
	<script src="js/argument.js"></script>
	<script src="js/fun.js"></script>
	<script src="js/nav.js"></script>
	<script src="js/pop.js"></script>
	<script src="js/getList.js"></script>

	<script type="text/javascript">
		var enLang = {
		    name  : "cn",
		    month : ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"],
		    weeks : [ "日","一","二","三","四","五","六" ],
		    times : ["时","分","秒"],
		    timetxt: ["时间","开始","结束"],
		    backtxt:"后退",
		    clear : "清空",
		    today : "当前",
		    yes   : "确定",
		    close : "关闭"
		}
		jeDate("#mine_start_time",{
		    // festival:true,
		    minDate:"1900-01-01",              //最小日期
		    maxDate:"2099-12-31",              //最大日期
		    method:{
		        choose:function (params) {
		            
		        }
		    },
		    format: "YYYY-MM-DD hh:mm:ss"
		}); 
		
		
		$('#buy_coin_id').select2()
		//need_invite_code
		$(function() {
			console.log($("[code = 300]"))
		})
		var radioKey = ['exchange_status']
		//获取
		function renderSet() {
			$.ajax({
				type: "post",
				'contentType': "application/x-www-form-urlencoded",
				"headers": {
					"auth-token": localStorage.getItem("wallet_token")
				},
				url: url + "Back_GetMineSetting",
				dataType: 'json',
				success: function(res) {
					if(res.status == 1) {
						$.each(res.data, function(index, item) {
							if(radioKey.indexOf(index)!=-1 && item == 1 ){
								$("#" + index).prop('checked',true);
							}else if(index == 'buy_coin_id'){
								var arr = item == "" ?[]:item.split(",")
								$("#buy_coin_id").val(arr).trigger('change')
								return 
							}
							
							$("#" + index).val(item);
						})
						// if($("#register_reward_status").val() == 0) {
						// 	$("#register_reward_num").prop("disabled", true);
						// }
						// $('#op_password_init').val(res.data.op_password)
					} else if(res.status == 1000||res.status == 102){
						ToLogin()
						return
					}else{
						alert(res.msg);
					}
				}
			})
		}
		

		// $("#register_reward_status").change(function() {
		// 	if($("#register_reward_status").val() == 0) {
		// 		$("#register_reward_num").prop("disabled", true);
		// 	} else {
		// 		$("#register_reward_num").prop("disabled", false);
		// 	}
		// })

		function opPwModal() {
			$("#opPwModal input").val("");
			$("#opPwModal").modal('show');
		}
		function renderForm(id){
			let formList = $("#"+id).serializeArray()
			var data={}
			$.each(formList,function(idnex,item){
				data[item.name] = item.value
			})
			return data
		}
		function set() {
			var data = renderForm("setting")
			$.each(radioKey,function(index,item){
				data[item] = $("#"+item).prop("checked")?1:0
			})
			data.buy_coin_id = $('#buy_coin_id').select2('val').join(",")
			data.op_password = $("#opPwModal [name = opPw]").val()
			console.log(data)
			$.ajax({
				type: "post",
				'contentType': "application/x-www-form-urlencoded",
				"headers": {
					"auth-token": localStorage.getItem("wallet_token")
				},
				url: url + "Back_UpdateMineSetting",
				data: {
					data: JSON.stringify(data)
				},
				dataType: 'json',
				success: function(res) {
					if(res.status == 1) {
						move("success", res.error)
						$("#opPwModal").modal('hide');
					} else if(res.status == 1000||res.status == 102) {
						ToLogin(res);
					} else {
						alert(res.error);
						// renderSet();
						$("#opPwModal").modal("hide");
						return false;
					}
				}
			})
		}
		
		$.ajax({
			type: "post",
			'contentType': "application/x-www-form-urlencoded",
			"headers": {
				"auth-token": localStorage.getItem("wallet_token")
			},
			url: url + "Back_MainChainForCoin",
			data: {
				data: JSON.stringify({
					page_num: 1
				})
			},
			dataType: 'json',
			success: function(res) {
				if(res.status == 1) {
					$.each(res.data, function(index, item) {
						$(".coin_id").append("<option value='" + item.id + "'>" + item.name + "</option>")
					})
					renderSet();
				} else if(res.status == 1000||res.status == 102) {
					ToLogin(res);
				} else {
					alert(res.error);
					return false;
				}
			}
		})
		
		//renderSet();
		// $.ajax({
		// 	type: "post",
		// 	'contentType': "application/x-www-form-urlencoded",
		// 	"headers": {
		// 		"auth-token": localStorage.getItem("wallet_token")
		// 	},
		// 	url: url + "Back_MainChainForCoin",
		// 	data: {
		// 		data: JSON.stringify({
		// 			page_num: 1
		// 		})
		// 	},
		// 	dataType: 'json',
		// 	success: function(res) {
		// 		if(res.status == 1) {
		// 			$.each(res.data, function(index, item) {
		// 				$(".coin_id").append("<option value='" + item.id + "'>" + item.name + "</option>")
		// 			})
		// 			renderSet();
		// 		} else if(res.status == 1000||res.status == 102) {
		// 			ToLogin(res);
		// 		} else {
		// 			alert(res.error);
		// 			return false;
		// 		}
		// 	}
		// })

		// $(".onePic").change(function() {
		// 	var ufile =  new UCloudUFile(bucketName, bucketUrl, tokenPublicKey, tokenPrivateKey, tokenServerUrl, prefix);
		// 	var date = new Date()
		// 	var fileRename = date.valueOf()+Math.ceil(Math.random()*100);
		// 	var file = $(this)[0].files[0];
		// 	console.log(file);
		// 	var that = $(this)
		// 	var data = {
		// 		file: file,
		// 		fileRename: fileRename
		// 	};
		// 	var errorCallBack = function(res) {
		// 		console.log(res)
		// 	};
		// 	var successCallBack = function(res) {
		// 		that.siblings('img').attr("src", bucketUrl + fileRename)
		// 		that.attr('img_url',fileRename);
		// 	};
		// 	var progressCallBack = function(res) {};

		// 	ufile.uploadFile(data, successCallBack, errorCallBack, progressCallBack);
		// })
	</script>
	</body>

</html>